﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include "GcmpModel.h"

namespace gcmp
{
    class IDocument;
    class IElement;
    class ICopyStrategyReporter;

    /// \brief 构件导出错误类型
    enum class ElementsExportErrorType : int32_t
    {
        NoError = 0,             ///< 无错误
        InvalidElementId = 1     ///< ElementID非法
    };

    typedef void FuncCopyStrategyFilter(const IElement*, ICopyStrategyReporter*);

    class GCMP_MODEL_EXPORT ElementsExportUtils
    {
    public:

        /*!
        *@brief      获取所有需要导出对象的elementID;
        *@author     zhangkai;
        *@date       2021年08月25日
        *@param[in]  const gcmp::IDocument* pOpenDocument 当前文档
        *@param[in]  const std::vector<ElementId>& elementsExport 导入的element ID
        *@param[out] std::set<gcmp::GraphicsMaterialGuid>& setGraphicsMaterialGuid 导入的element使用的项目材质的GUID
        *@param[out] std::set<std::wstring>& familyNames 导入的element使用的族名称
        *@param[in]  FuncCopyStrategyFilter funcElementsFilter, CopyStrategyReporter中保存了当前element依赖的对象，对这些对象可以进行过滤;
        *@return     std::set<ElementId> 所有相关的需要导出的element的ID
        */
        static std::set<ElementId> GetAllElementNeedExport(IDocument* pDocument, const std::vector<ElementId>& elementsExport, 
            std::set<std::wstring>& graphicsMaterialGuidStrings, std::set<std::wstring>& familyNames, FuncCopyStrategyFilter funcElementsFilter, ElementsExportErrorType* exportErrorType = nullptr);
    };
}